﻿using System;
using System.Collections;
using System.Reflection;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;using THSERP.BusinessEntities;using THSERP.BaseProvider;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using THSLib;using THSERP.BaseProvider;

namespace THSERP
{
    public partial class guiCustomersInfo : THSERPScreen
    {
        public guiCustomersInfo()
        {
            InitializeComponent();
        }

        private void fld_btnClose_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        public void DisplayCustomerInfo(ARCustomersInfo objCustomersInfo)
        {
            DisplayLabelText(objCustomersInfo, Controls);
            fld_lblDOB.Text = objCustomersInfo.ARCustomerContactBirthday.ToShortDateString();
        }

        private void fld_btnEdit_Click(object sender, EventArgs e)
        {
            BRPOSsInfo objBRPOSsInfo = (BRPOSsInfo)((BaseModuleERP)this.Module).CurrentModuleEntity.MainObject;
            Modules.Customer.CustomerModule customerModule = (Modules.Customer.CustomerModule)((BaseModuleERP)this.Module).ParentScreen.ShowModule("Customer");
            for (int i = 0; i < customerModule.Toolbar.ObjectCollection.Tables[0].Rows.Count; i++)
                if (objBRPOSsInfo.FK_ARCustomerID == Convert.ToInt32(customerModule.Toolbar.ObjectCollection.Tables[0].Rows[i]["ARCustomerID"]))
                {
                    customerModule.Toolbar.CurrentIndex = i;
                    customerModule.FocusRowOfGridSearchResultByToolbarCurrentIndex();
                    customerModule.Invalidate(objBRPOSsInfo.FK_ARCustomerID);
                    customerModule.ActionEdit();
                    return;
                }
        }
    }
}